﻿--HEADER Drop Columns


DECLARE @SQL VARCHAR(MAX)
SET @SQL =
(
SELECT so.name
FROM sysobjects so
INNER JOIN sysconstraints sc ON so.id = sc.constid
INNER JOIN syscolumns c ON sc.id = c.id AND sc.colid = c.colid
WHERE OBJECT_NAME(so.parent_obj) = 'OriginalPositionValidationData'
AND c.name = 'TradeFxPnLCheked'
AND so.xtype = 'D'
)
SET @SQL = 'ALTER TABLE [TradingData].[OriginalPositionValidationData] DROP CONSTRAINT ' + @SQL + ''
EXEC(@SQL)
SET @SQL = 'ALTER TABLE [TradingData].[OriginalPositionValidationData] DROP COLUMN TradeFxPnLCheked'
EXEC(@SQL)



SET @SQL =
(
SELECT so.name
FROM sysobjects so
INNER JOIN sysconstraints sc ON so.id = sc.constid
INNER JOIN syscolumns c ON sc.id = c.id AND sc.colid = c.colid
WHERE OBJECT_NAME(so.parent_obj) = 'OriginalPositionValidationData'
AND c.name = 'PositionFxPnLCheked'
AND so.xtype = 'D'
)
SET @SQL = 'ALTER TABLE [TradingData].[OriginalPositionValidationData] DROP CONSTRAINT ' + @SQL + ''
EXEC(@SQL)
SET @SQL = 'ALTER TABLE [TradingData].[OriginalPositionValidationData] DROP COLUMN PositionFxPnLCheked'
EXEC(@SQL)

